<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var twoSum = function(nums, target) {
            var res = [];
            for (var i = 0; i < nums.length; i++) {
                for (var j = i + 1; j < nums.length; j++) {
                    var a = (nums[i] + nums[j] == target);
                    debugger
                    if (a) {
                        var dd = res.concat(i, j);
                        return dd;
                    }
                }
            }
        };
        var a = twoSum([3, 2, 4], 6);
        console.log(a)
    </script>
</body>

</html>